import stoneRequest from "@/service";

export function postUserList(queryInfo: any) {
  return stoneRequest.post({
    url: '/users/list',
    data: queryInfo
  })
}

export function deleteUserById(id: number) {
  return stoneRequest.delete({
    url: `/users/${id}`
  })
}

export function newUserInfo(userInfo: any) {
  return stoneRequest.post({
    url: '/users',
    data: userInfo
  })
}

export function editUserInfo(id: number, userInfo: any) {
  return stoneRequest.patch({
    url: `/users/${id}`,
    data: userInfo
  })
}


//针对页面的真删改查
export function postPageListData(pageName: string, queryInfo: any) {
  return stoneRequest.post({
    url: `/${pageName}/list`,
    data: queryInfo
  })
}

/**
 * 
 * 删除
 */
export function deletePageById(pageName: string, id: number) {
  return stoneRequest.delete({
    url: `/${pageName}/${id}`
  })
}

/**
 * 
 * 新增
 */
export function newPageData(pageName: string, pageInfo: any) {
  return stoneRequest.post({
    url: `/${pageName}`,
    data: pageInfo
  })
}

/**
 * 
 * 编辑更新
 */
export function editPageData(pageName: string, id: number, pageInfo: any) {
  return stoneRequest.patch({
    url: `/${pageName}/${id}`,
    data: pageInfo
  })
}
